package com.fosun.spr.plugin.uuc.api.uucRoleUser.control;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.fosun.spr.plugin.uuc.api.uucRoleUser.service.UucRoleUserService;
import com.fosun.spr.plugin.uuc.api.uucRoleUser.service.model.CreateOrUpdateSpModel;
import com.fosun.spr.plugin.uuc.api.uucRoleUser.service.model.CreateOrUpdateSrModel;
import com.fosun.spr.plugin.uuc.api.uucRoleUser.service.model.DeleteSpModel;
import com.fosun.spr.plugin.uuc.api.uucRoleUser.service.model.DeleteSrModel;
import com.fosun.spr.plugin.uuc.api.uucRoleUser.service.model.GetSpModel;
import com.fosun.spr.plugin.uuc.api.uucRoleUser.service.model.GetSrModel;
import com.fosun.spr.plugin.uuc.api.uucRoleUser.service.model.ListSpModel;
import com.fosun.spr.plugin.uuc.api.uucRoleUser.service.model.ListSrModel;
import com.fosun.spr.core.utils.SessionUtils;
import com.fosun.spr.core.base.CoBaseControl;

@RestController
public class UucRoleUserControl extends CoBaseControl {
	@Resource
	private UucRoleUserService uucRoleUserService;

	/**
	 * http://127.0.0.1:8081/api/uucRoleUser/list
	 * @param request
	 * @param spModel
	 * @return
	 */
	@RequestMapping(value = "/api/uucRoleUser/list",method = RequestMethod.GET)
	public ListSrModel list(HttpServletRequest request,ListSpModel spModel) {
		SessionUtils.fillSpModel(request, spModel);
		return uucRoleUserService.list(spModel);
	}
	/**
	 * http://127.0.0.1:8081/api/uucRoleUser/get?id=1
	 * @param request
	 * @param spModel
	 * @return
	 */
	@RequestMapping(value = "/api/uucRoleUser/get",method = RequestMethod.GET)
	public GetSrModel get(HttpServletRequest request,GetSpModel spModel) {
		SessionUtils.fillSpModel(request, spModel);
		return uucRoleUserService.get(spModel);
	}
	/**
	 * http://127.0.0.1:8081/api/uucRoleUser/delete
	 * {"id":"1"}
	 * @param request
	 * @param spModel
	 * @return
	 */
	@RequestMapping(value = "/api/uucRoleUser/delete",method = RequestMethod.POST)
	public DeleteSrModel delete(HttpServletRequest request,@RequestBody DeleteSpModel spModel) {
		SessionUtils.fillSpModel(request, spModel);
		return uucRoleUserService.delete(spModel);
	}	
	/**
	 * http://127.0.0.1:8081/api/uucRoleUser/createOrUpdate
	 * @param request
	 * @param spModel
	 * @return
	 */
	@RequestMapping(value = "/api/uucRoleUser/createOrUpdate",method = RequestMethod.POST)
	public CreateOrUpdateSrModel createOrUpdate(HttpServletRequest request,@RequestBody CreateOrUpdateSpModel spModel) {
		SessionUtils.fillSpModel(request, spModel);
		return uucRoleUserService.createOrUpdate(spModel);
	}	
	
 
}
